package com.skywolf.chem.customer.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.skywolf.chem.common.sysconfig.pojo.vo.PageVO;
import com.skywolf.chem.customer.entity.Customer;
import com.skywolf.chem.customer.mapper.CustomerMapper;
import com.skywolf.chem.customer.service.ICustomerService;
import com.skywolf.chem.home.entity.LoopImgVo;
import com.skywolf.chem.home.entity.UsersVo;
import com.skywolf.chem.manager.param.CusManagerParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 用户信息表 服务实现类
 * </p>
 *
 * @author 
 * @since 2020-11-29
 */
@Service
public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> implements ICustomerService {


    @Autowired
    CustomerMapper customerMapper;

    @Override
    public PageVO<UsersVo> pageUsersList(CusManagerParam queryParam) {
        Long startNum = queryParam.getPageSize()*(queryParam.getPageNum()-1);
        Long endNum = queryParam.getPageSize();
        Integer count = customerMapper.getUserPageCount(queryParam.getPhone(),queryParam.getUserName());
        List<UsersVo> list = customerMapper.getUserPageList(startNum,endNum,queryParam.getPhone(),queryParam.getUserName());
        PageVO<UsersVo> pageVO = new PageVO(list,Long.valueOf(count),queryParam.getPageNum(),queryParam.getPageSize());
        return pageVO;
    }
}
